package com.gitee.deament.server.core.data.storage.impl;


import com.gitee.deament.server.core.data.storage.SelectDBStorage;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @author  deament
 */
public class MemorySelectDBStorage implements SelectDBStorage {
   static  Map<String,Integer > data= new ConcurrentHashMap<>();
    @Override
    public void changeDB(int dbindex, String channelId) {
        data.put(channelId,dbindex);
    }

    @Override
    public int getUseDB(String channelId) {

        return data.get(channelId)==null?0:data.get(channelId);
    }

    @Override
    public void removeChannel(String channelId) {
        data.remove(channelId);
    }
}
